Ext.onReady(function(){
	/**
	 * 测试数据
	 */
	var testData=[
		['大漠1',25,'你猜？','我不告诉你','电信','88403922',1],
		['大漠2',25,'你猜？','我不告诉你','电信','88403922',2],
		['大漠3',25,'你猜？','我不告诉你','电信','88403922',3],
		['大漠4',25,'你猜？','我不告诉你','电信','88403922',4],
		['大漠5',25,'你猜？','我不告诉你','电信','88403922',5],
		['大漠6',25,'你猜？','我不告诉你','电信','88403922',6],
		['大漠7',25,'你猜？','我不告诉你','电信','88403922',7],
		['大漠8',25,'你猜？','我不告诉你','电信','88403922',8],
		['大漠9',25,'你猜？','我不告诉你','电信','88403922',9],
		['大漠10',25,'你猜？','我不告诉你','电信','88403922',10]
	];
	
	/**
	 * 数据格式器
	 */
	var reader=new Ext.data.ArrayReader({},[
		{name:'name',type:'string'},
		{name:'age',type:'int'},
		{name:'work',type:'string'},
		{name:'company',type:'string'},
		{name:'industry',type:'string'},
		{name:'QQ',type:'string'},
		{name:'id',type:'int'}
	])
	
	/**
	 * 数据缓存器
	 */
	var store=new Ext.data.Store({
		reader:reader,
		data:testData
	})
	
	/**
	 * 行选择器
	 */
	var sm = new Ext.grid.CheckboxSelectionModel();
	
	/**
	 * 自动行号
	 */
	var rowNum=new Ext.grid.RowNumberer({
		header:'序号',
		width:30
	});
	
	/**
	 * 数据列模型
	 */
	var cm=new Ext.grid.ColumnModel([
		sm,
		rowNum,
		{header: "姓名", dataIndex:'name',width: 100, sortable: true},
		{header: "年龄", dataIndex:'age',width: 50, sortable: true},
		{header: "工作", dataIndex:'work',width: 150, sortable: true},
		{header: "公司", dataIndex:'company',width: 100, sortable: true},
		{header: "所属行业", dataIndex:'industry',width: 80, sortable: true},
		{header: "QQ群", dataIndex:'QQ',width:150, sortable: true},
	  	{header: "操作", 
	  	 dataIndex:'name',
	  	 width:150, 
	  	 sortable: true,
	  	 renderer:function(v,meta,record){
          	var resultStr = "";
          	var formatStr = "<a href='javascript:void({2});' onclick='javscript:return false;' class='{1}'>{0}</a>";
          	resultStr += String.format(formatStr,'详细','alarm_detail',record.id);
          	resultStr += ' | ' + String.format(formatStr,'签阅','alarm_check',record.id);
          	resultStr += ' | ' + String.format(formatStr,'删除','alarm_delete',record.id);
            return "<div class='controlBtn'>"+resultStr+"</div>";
          }
	  	}
	]);
	
	var myGrid=new Ext.MyGrid({
		width:600,
		height:300,
		renderTo:Ext.getBody(),
		cm:cm,
		sm:new Ext.grid.CheckboxSelectionModel(),
		store:store
	});
	
	var win=new Ext.Window({
		title:'通用数据展示页面',
		width:850,
		height:450,
		buttonAlign:'right',
		layout:'fit',
		items:[myGrid],
		buttons:[
			{
				text:'关闭',
				handler:function(){
					win.close();
				}
			},
			{
				text:'提交',
				handler:function(){
					Ext.Msg.alert('温馨提示','真的要提交吗？');
				}
			}
		]
	});
	win.show();
})